﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head><link rel="stylesheet" href="${ctx}/common/common.css">
    <title>Title</title>
    <link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/style/admin.css" media="all">
    <script src="${ctx}/common/plugins/layuiadmin/layui/layui.js"></script>
    
</head>
<body>
<!--主体内容层-->

<!--主体内容层-->
<div class="layui-fluid">
	<div class="layui-row layui-col-space15">
		<form class="layui-form" action="${ctx}/role/updateFun">
		<input type="hidden" name="roleId" value="${roleId}">
		<c:forEach items="${funAndChildrenList}" var="fc">
			<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
			</fieldset>
			<div class="layui-form-item" pane="">
			   <input type="checkbox" name="funIds" value="${fc.id}" lay-skin="primary" title="${fc.name}"
			   <c:forEach items="${roleAndfunList}" var="rf"> 
	                 <c:if test="${rf.id eq fc.id}"> checked="checked"</c:if>
	            </c:forEach>/>		
	        </div>
			<div class="layui-form-item" pane="">
				<div class="layui-input-block">
					<c:forEach items="${fc.childrens}" var="fcc">
						<input type="checkbox" name="funIds" value="${fcc.id}" lay-skin="primary" title="${fcc.name}"
						 <c:forEach items="${roleAndfunList}" var="rf"> 
		                 	<c:if test="${rf.id eq fcc.id}"> checked="checked"</c:if>
		                 </c:forEach>/>
					</c:forEach>
				</div>
			</div>
		</c:forEach>
		<div class="layui-form-item">
			<button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
		</div>
		</form>
	</div>
</div>
<script>			
	layui.use(['form', 'layedit', 'laydate'], function() {
		var form = layui.form,
			layer = layui.layer,
			layedit = layui.layedit,
			laydate = layui.laydate;

		//自定义验证规则
		form.verify({
			title: function(value) {
				if(value.length < 5) {
					return '标题至少得5个字符啊 ';
				}
			},
			pass: [/(.+){6,12}$/, '密码必须6到12位'],
			content: function(value) {
				layedit.sync(editIndex);
			}
		});

		//监听提交
		form.on('submit(demo1)', function(data) {
			
		});
	});
</script>
</html>



